package com.fy.service.server.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.fy.common.constant.Constants;
import com.fy.common.constant.RedisKeyConstant;
import com.fy.common.entity.SkImChatSession;
import com.fy.common.model.im.MessageModel;
import com.fy.framework.component.config.RedissonComponet;
import com.fy.service.service.MessageService;
import com.fy.service.service.SkImChatSessionService;
import com.google.gson.JsonObject;
import com.xiaoju.uemc.tinyid.client.utils.TinyId;

import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.*;
import org.redisson.api.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.convert.Bucket;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Date;
import java.util.Map;

/**
 * Description： 测试作用
 */
@ApiIgnore
@Controller
@RequestMapping(value = "/redis")
public class RedisController {


    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    RedissonComponet redissonComponet;
    @Autowired
    private RedissonClient redisson;

    @Autowired
    private SkImChatSessionService skImChatSessionService;
    @ResponseBody
    @RequestMapping(value = "/token", produces = {"application/json;charset=UTF-8"})
    public String TestSend() {

        try {
/*            MapOptions<String,JSONObject> mapOptions =  MapOptions.defaults();
            mapOptions.w*/
            //RMapCache<String,JSONObject> obj =  redisson.getMapCache("pig|NIM_USER_TOKEN_1468065106149605378");
           //RMap<String, String> key = redisson.getMap("pig|NIM_USER_TOKEN_1468065106149605378");
            //JSONObject onj = obj.get("UserOnlineStatus");


           /* redissonComponet.get
            HashOperations<String, String, String> hps = redisTemplate.opsForHash();
            String object = hps.get("pig|FootballGamePay_key3529589","220769");
            System.out.println(object);
*/
        /*    redissonComponet.getMapValue()
            redissonComponet.getm
*/
            RMapCache<String,JSONObject> obj =  redisson.getMapCache(RedisKeyConstant.GROUP_MEMBERS);
            return "成功";
        } catch (Exception e) {
            logger.error("hbase写入数据错误",e);
            return "失败";
        }
    }










}